home *** CD-ROM | disk | FTP | other *** search
/ Delphi Magazine Collection 2001 / Delphi Magazine Collection 20001 (2001).iso / DISKS / ISSUE23 / CLINIC / LOCATEU.PAS < prev    next >
Pascal/Delphi Source File  |  1997-04-27  |  839b  |  42 lines

  1. unit LocateU;
  2.  
  3. interface
  4.  
  5. uses
  6.   Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  7.   StdCtrls, Grids, DBGrids, Db, DBTables;
  8.  
  9. type
  10.   TForm1 = class(TForm)
  11.     Table1: TTable;
  12.     DataSource1: TDataSource;
  13.     DBGrid1: TDBGrid;
  14.     EdtCustNo: TEdit;
  15.     EdtCompany: TEdit;
  16.     Label1: TLabel;
  17.     Label2: TLabel;
  18.     Button1: TButton;
  19.     procedure Button1Click(Sender: TObject);
  20.   private
  21.     { Private declarations }
  22.   public
  23.     { Public declarations }
  24.   end;
  25.  
  26. var
  27.   Form1: TForm1;
  28.  
  29. implementation
  30.  
  31. {$R *.DFM}
  32.  
  33. procedure TForm1.Button1Click(Sender: TObject);
  34. begin
  35.   if not Table1.Locate('CustNo;Company',
  36.        VarArrayOf([EdtCustNo.Text, EdtCompany.Text]),
  37.        [loPartialKey, loCaseInsensitive]) then
  38.     raise Exception.Create('Search values not found')
  39. end;
  40.  
  41. end.
  42.